package com.mexico.inloancash.adapter;


import android.app.Activity;
import android.content.Intent;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mexico.inloancash.R;
import com.mexico.inloancash.activity.India_MyBank_Info_Activity;
import com.mexico.inloancash.bean.India_BankingCheck_ListBean;


public class IndiaBindBankAdapter extends BaseQuickAdapter<India_BankingCheck_ListBean.DataBean.BankListsBean, BaseViewHolder> {

    public IndiaBindBankAdapter(){
        this(R.layout.india_activity_bank_view_layout_item);
    }
    public IndiaBindBankAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, final India_BankingCheck_ListBean.DataBean.BankListsBean item) {
        helper.setText(R.id.bank_name, item.getBankname());
        String str = item.getBankno().substring(item.getBankno().length()- 4 );
        helper.setText(R.id.bank_count,"**** **** **** " + str);

        if(item.getRadom() == 1){
            helper.setBackgroundRes(R.id.bank_back,R.mipmap.india_add_picture_bankcard_pic_2bg);
        }else {
            helper.setBackgroundRes(R.id.bank_back,R.mipmap.india_add_picture_bankcard_pic_1bg);
        }
        helper.getView(R.id.bank_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, India_MyBank_Info_Activity.class);
                intent.putExtra("id",item.getId());
                intent.putExtra("bankno",item.getBankno());
                intent.putExtra("bank",item.getBankname());
                intent.putExtra("radom",item.getRadom());
                ((Activity) mContext).startActivityForResult(intent,0);
            }
        });
    }
}
